from froModuleDrivers.gateway import GatewayDriver  # 引用网关驱动模块
from froModuleDrivers.nioManager import NioManager  # 引用驱动管理模块
import time

# 驱动初始化
driver_buzzer = GatewayDriver("192.168.50.212", 4001)  # 实例化网关驱动
manager = NioManager(driver_buzzer)  # 实例化驱动管理模块，并把网关驱动加入管理
manager.run()  # 系统运行

# 蜂鸣器模块的3个相关API
# 蜂鸣器模块放在2号节点上
# 播放曲目
driver_buzzer.playSongBySongID(2,2)

# 获取蜂鸣器当前的状态
print(driver_buzzer.audioPlayerCurrentPlayed(2))

# 获取到蜂鸣器当前播放的曲目值
print(driver_buzzer.audioPlayerCurrentPlayedSong(2))

# 获取到蜂鸣器当前的音量
print(driver_buzzer.audioPlayerCurrentPlayedVolumn(2))

# 等待指令执行完毕后系统退出
time.sleep(1)
manager.shutdownGracefully()